import { getToken } from "@/utils/token"
import { ReactNode } from "react"
import { Navigate } from "react-router-dom"

interface Props{
    children: ReactNode
}


const AuthRoute = ({children}:Props) => {
    const isToken = getToken()    
    if(isToken){
        return <> { children } </>
    }else{
        return <Navigate to='./login' replace></Navigate>
    }
}

export default AuthRoute